package com.milhouz.bomberrokon.factories;

import java.io.IOException;

import android.content.res.AssetManager;
import android.util.Log;

import com.milhouz.bomberrokon.util.BomberXmlReader;

/**
 * Factory manipulating Bombers<br>
 * <ul>
 * <li>List available bombers</li>
 * </ul>
 */
public class BombersFactory {

	private static BombersFactory factory = null;

	public static BombersFactory getFactory() {
		if (BombersFactory.factory == null) {
			BombersFactory.factory = new BombersFactory();
		}
		return BombersFactory.factory;
	}

	/** List bombers names from bomber directory */
	public String[] listBombers(AssetManager assetManager, int tileSize) {
		String tilePath = tileSize + "x" + tileSize;
		try {
			return assetManager.list(BomberXmlReader.ASSETS_IMG_FOLDER + "/" + tilePath + "/" + BomberXmlReader.ASSETS_BOMBER_FOLDER);
		} catch (IOException e) {
			Log.e("bomber", "Unable to list the assets/bombers folder.");
		}
		return null;
	}

}
